← Back
Editing: store3.js
import{u as e,K as a,cL as t,o as s,R as r,l as i,L as o,M as n,r as l,cA as c,cI as u,cM as d,cN as v,cO as m,bb as p,cG as g,cH as y,at as w,Z as h,ai as f,cB as _,Q as S,by as T,cP as b,cQ as I,cR as E,cS as L,cT as x,cU as P}from"./utils-lib.js?v=1765440387";import{j as R,t as q,s as U,r as O,az as D,k as V}from"./base-lib.js?v=1765440387";import{H as j}from"./store4.js?v=1765440387";import{u as A,p as H,v as k}from"./validator.js?v=1765440387";const C=R("HOME-HEADER-STORE",()=>{const{panelVersion:R,payment:C,updatePush:M,panel:B,push:N,plugin:$,getUpdatePushInfo:F,getOldSenderAlarmListInfo:G}=e(),{bindUser:J,authType:Q,authExpirationTime:z}=q(C.value),K=j(),{panelInfo:Z,systemInfo:W}=U(K),{upgrade:X,currentInfo:Y}=q(Z.value),ee=O([["plunge","30+款付费插件"],["function","20+企业版专享功能"],["certificate","2张SSL商用证书"],["message","1000条免费短信"],["time","5分钟极速响应"],["other","更多特权>>"]]),ae=O([["plugin","30+款付费插件"],["more","20+企业版专享功能"],["recom","2张SSL商用证书"],["message","1000条免费短信"],["speed","5分钟极速响应"],["other","更多特权>>"]]),{isDebug:te}=B.value,{isBeta:se,cloudBeta:re,isUpgrade:ie,grayscale:oe}=q(Z.value),ne=O(!1),le=O(!1),ce=O(""),ue=O(!1),de=O(null),ve=O({}),me=O({}),pe=O({phone:"",status:!1}),ge=O({phone:[{validator:(e,a,t)=>{pe.value.status?/^1[3456789]\d{9}$/.test(a)||/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(a)?t():t(new Error("请输入正确的手机号码或邮箱")):t()}}],give:[{required:!0,validator:(e,a,t)=>{0===a.length?t(new Error("请选择至少一种告警方式")):t()},trigger:["blur","change"]}]}),ye=D("popupClose",()=>{}),we=async(e={})=>{try{const{data:a}=await g(e),t=window.vite_public_version,s=null==t?void 0:t.split(".").pop(),r=Number.parseInt(s).toString()===s&&2===s.length,{is_beta:i,version:o,beta:n,downUrl:l,updateMsg:c,uptime:u,grayscale_test:d}=a.msg;return re.value=i,se.value=r,ve.value=n,me.value={downUrl:l,updateMsg:c,version:o,uptime:u},oe.value=d,a.status&&(ie.value=y(R.value,se.value?n.version:o)),a}catch(a){return w(a),!1}},he=async e=>{fe.value=e||!1,be.value.switch=!0,i({title:"更新提示",area:50,btn:!0,component:()=>o(()=>import("./alarm.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)})},fe=O(!1),_e=O(),Se=O(),Te=O(!1),be=O({switch:M.value.updatePush,give:[""],option:{}}),Ie=O(!0),Ee=O(!1),Le=O(),xe=O([]);let Pe;const Re=V({webServe:!1,mysqlServe:!1,restartServe:!1,serveStart:!1}),qe=()=>{Pe=setInterval(async()=>{try{const e=await I();e&&(e.hasOwnProperty("status")||void 0!==e.code)&&(n.success("服务器重启成功!"),setTimeout(()=>{localStorage.clear(),sessionStorage.clear(),window.location.reload()},2e3),clearInterval(Pe))}catch(e){w(e)}},3e3)},Ue=O(""),Oe=async()=>{try{Pe&&clearTimeout(Pe);const{data:e}=await E();e.status||f(e.data)?(Ue.value=f(e.data)?e.data:e.msg||"暂无日志",f(e.data)?(n.msg({customClass:"bt-message-error-html",dangerouslyUseHTMLString:!0,message:e.msg+"".concat(e.status?"<br>请按 Ctrl+F5 刷新缓存,或等待5s自动刷新!":""),type:e.status?"success":"error",showClose:!e.status,duration:e.status?5e3:0}),e.status&&setTimeout(()=>{localStorage.clear(),sessionStorage.clear(),window.location.reload()},5e3)):Pe=setTimeout(()=>{Oe()},2e3)):n.error(e.msg)}catch(e){Pe&&clearTimeout(Pe),Pe=setTimeout(()=>{Oe()},2e3)}},De=O(!1),Ve=O([]);return{bindUser:J,authType:Q,authExpirationTime:z,systemInfo:W,panelInfo:Z,panelVersion:R,formPhone:de,jumpRouter:e=>{l.push({path:"/config/".concat(e)})},histVersionInfoDialog:async()=>i({title:"历史版本",area:[60,52],component:()=>o(()=>import("./index309.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)}),onRepair:async()=>{if(await A())return null;await a({loading:"正在获取数据,请稍后...",request:t(),success:async e=>{const l=e.data;1===l.upgrade?(await s({title:"修复面板",content:'<div class="flex items-center">\n <div class="mr-1rem w-[4rem]"><img width="40" src="/static/icons/icon-upgrade.svg"></img></div>\n <div class="flex-1">\n <div class="text-[1.6rem] leading-2.4rem">发现新版本,继续修复面板能修复使用中遇到的各种异常问题</div>\n </div>\n </div>\n <div class="pl-5rem mt-[4px]">\n <div>最新版本:'.concat(l.cloud.version,"</div>\n <div>更新时间:").concat(r(1e3*l.cloud.update_time),"</div>\n </div>"),icon:!1,width:"40rem",isHtml:!0,confirmText:"继续修复"}),a({loading:"正在修复面板,请稍后...",request:t({force:1}),message:!0,success:e=>{localStorage.clear(),sessionStorage.clear(),e.status&&setTimeout(()=>{i({title:"正在".concat("repair"===l.type?"修复":"更新","面板,请耐心等候..."),area:70,compData:{type:"repair"},component:()=>o(()=>import("./index23.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)})},1500)}})):n.msg({message:'<div style="line-height:22px;">\n <div>当前已是最新版本</div>\n <div>当前版本:'.concat(l.local.version,"</div>\n <div>更新时间:").concat(r(1e3*l.local.update_time),"</div>\n </div>"),type:"success",dangerouslyUseHTMLString:!0})}})},restartSeverDialog:async()=>await A()?null:i({title:"重启服务器或者面板",area:[33,11],component:()=>o(()=>import("./index145.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)}),updateVersionDialog:async()=>await A()?null:i({area:50,component:()=>o(()=>import("./index310.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)}),advantageList:ee,productPayment:()=>{H({disablePro:!0,sourceId:300})},loading:ne,isUpgrade:ie,grayscale:oe,isBeta:se,betaInfo:ve,officialInfo:me,update:M,isNPSShow:ue,questions:ce,form:pe,rules:ge,onOpen:async()=>{try{ne.value=!0;const e=await we({check:!0});if(h(e))return;!e.status&&f(e.msg)&&(ye(),n.error(e.msg))}catch(e){w(e)}finally{ne.value=!1}},submit:async e=>{if(""===ce.value)throw n.error("还有必填项没有填写哦~"),new Error("还有必填项没有填写哦~");de.value.validate(async t=>{if(t){const t=(s=pe.value.phone,/^1[3456789]\d{9}$/.test(s)?"phone":/^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/.test(s)?"email":"unknown"),r={questions:JSON.stringify({22:ce.value}),product_type:18,software_name:1,rate:0};pe.value.status&&(r.feedback=JSON.stringify("phone"===t?{phone:pe.value.phone}:{email:pe.value.phone})),a({loading:"正在提交问卷,请稍后...",request:p(r),success:a=>{a.status&&(k(),e())}})}var s})},ignoreUpdatEVersion:(e,t)=>{a({loading:"正在忽略本次更新,请稍后...",request:m({version:e}),message:!0,success:e=>{e.status&&t()}})},getUpdatePushInfo:F,openUpdateReminder:async()=>{M.value.updatePush?he(!M.value.updatePush):a({loading:"正在设置更新提醒,请稍后...",request:c({task_id:M.value.updateTaskId,status:0}),message:!0})},updateReminderDialog:he,updateVersion:async e=>{let t;try{if("boolean"!=typeof e)return 0!==X.value?(await s({title:"升级面板",content:'<div class="flex items-center">\n <div class="mr-1rem w-[4rem]"><img width="40" src="/static/icons/icon-upgrade.svg"></img></div>\n <div class="flex-1">\n <div class="text-[1.6rem] leading-2.4rem">升级面板可以修复大部分已知BUG,同时安装最新的功能,用户数据也不会受到影响</div>\n </div>\n </div>\n <div class="pl-5rem mt-[4px]">\n <div>即将更新到:'.concat(Y.value.version,"</div>\n <div>更新时间:").concat(r(1e3*Y.value.update_time),"</div>\n </div>"),icon:!1,width:"40rem",isHtml:!0,confirmText:"继续升级"}),void a({loading:"正在升级面板,请稍后...",request:u({force:!0,version:Y.value.version}),message:!0,success:e=>{localStorage.clear(),sessionStorage.clear(),e.status&&setTimeout(()=>{i({title:"正在更新面板,请耐心等候...",area:70,compData:{type:"upgrade"},component:()=>o(()=>import("./index23.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)})},1500)}})):void n.msg({message:'<div style="line-height:22px;">\n <div>当前已是最新版本</div>\n <div>当前版本:'.concat(Y.value.version,"</div>\n <div>更新时间:").concat(r(1e3*Y.value.update_time),"</div>\n </div>"),type:"success",dangerouslyUseHTMLString:!0});if(await s({title:"升级面板",content:"温馨提示:升级面板,有助于面板的BUG修复和功能加强,但不会影响用户的数据,即使面板发生故障,用户数据也不会受到影响。请您放心进行升级。"}),t=await(async e=>{let a;try{const t=e?"升级Linux测试版":"切换到正式版",r=e?"请仔细阅读内测升级须知,是否升级Linux测试版?":"是否从测试版切换到正式版?";await s({type:"calc",title:t,content:r}),a=n.load("正在".concat(t,",请稍候...")),localStorage.clear(),sessionStorage.clear(),te&&(await v(),le.value=!0);const i=e?await x():await P();if(!i.status)return n.request(i)}catch(t){return!1}finally{ye(),localStorage.clear(),sessionStorage.clear()}return a})(e),!t)return;await we({check:!0});const l=await d({toUpdate:"yes"});le.value&&(await v(),le.value=!1),l.status?(n.success({msg:l.msg,onClose:()=>window.location.reload()}),setTimeout(()=>{window.location.reload()},2e3)):n.error(l.msg)}catch(l){t&&t.close()}finally{t&&t.close(),ye(),localStorage.clear(),sessionStorage.clear()}},alarmRef:_e,pushMsgRef:Se,msgForm:be,checkedLoad:Te,renderPushConfig:async()=>{Te.value=!0,await G(),Te.value=!1,be.value.give=M.value.modulePush,be.value.option=N.value.config},refreshAlarmEvent:()=>{var e;null==(e=_e.value)||e.refresh(),n.success("刷新成功")},onCancel:()=>{M.value.updatePush=fe.value},onConfirm:e=>{Se.value.validate(async t=>{if(t){const t={task_data:JSON.stringify({task_data:{tid:"10",type:"panel_update",title:"面板更新提醒",status:be.value.switch,count:0,interval:600,project:""},status:be.value.switch,sender:be.value.give,number_rule:{day_num:0,total:2},time_rule:{send_interval:0,time_range:[0,86399]}}),template_id:"10"};a({loading:"正在提交更新提示,请稍后...",request:_(t),message:!0,success:a=>{e(),F()}})}})},showFooter:Ie,showServer:Ee,serverRestartRef:Le,tipsList:xe,courseList:Re,clearRestart:()=>{Pe&&clearInterval(Pe)},onRestartServer:async()=>{var e;try{Z.value.isRestart=!0,xe.value.splice(0,xe.value.length),Ie.value=!1;const a=null==(e=Le.value)?void 0:e.closest(".el-dialog");if(a){const e=a.querySelector(".el-dialog__footer");a.querySelector(".el-dialog__body").style.height="48rem",e&&(e.style.display="none")}Re.webServe=!0,await T({name:$.value.webserver,type:"stop"}),Re.mysqlServe=!0,await T({name:"mysqld",type:"stop"}),Re.restartServe=!0,await b(),Re.serveStart=!0,qe()}catch(a){w(a)}},onRestartPanel:async()=>{await s({icon:"warning-filled",title:"重启面板",content:"即将重启面板服务,继续吗?"}),a({loading:"正在重启面板,请稍候...",request:S(),message:!0,success:e=>{e.status&&setTimeout(()=>{localStorage.clear(),sessionStorage.clear(),window.location.reload()},1e3)}})},logContent:Ue,getLog:Oe,hisLoading:De,histVersion:Ve,getHistoryVersion:async()=>{await a({loading:De,request:L(),data:[Array,Ve]})},$reset:()=>{ue.value=!1,ce.value="",pe.value={phone:"",status:!1}},v2AdvantageList:ae}});export{C as H}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel